#include<iostream>
using namespace std;


class Graph
{
public:
	char nodes[100];
	int matrix[100][100];
	int nodesnumber,arcsnumber;
	
};



void CreatMGraph(Graph *&MG)
{
	cout<<"enter the number of nodes and arcs:";
	cin>>MG->nodesnumber>>MG->arcsnumber;
	cout<<"enter the name of each vertex:";
	for(int i=0;i<MG->nodesnumber;i++)
	{
		char name;
		cin>>name;
		MG->nodes[i]=name;
	}
	for(int j=0;j<MG->nodesnumber;j++)
	{
		for(int k=0;k<MG->nodesnumber;k++) 
			MG->matrix[j][k]=0;
	}
	cout<<"enter the position of each vertex:";
	for(int p=0;p<MG->arcsnumber;p++)
	{
		int a,b;
		cin>>a>>b;
		while(a==b)
		{
			cout<<"error!please enter again:";
			cin>>a>>b;
		}
		MG->matrix[a][b]=1;
		MG->matrix[b][a]=1;
	}
}


void display(Graph *&MG)
{
	for(int i=0;i<MG->nodesnumber;i++)
	{
		for(int j=0;j<MG->nodesnumber;j++)
		{
			cout<<MG->matrix[i][j]<<" ";
		}
		cout<<endl;
	}
}



int main()
{
	Graph *g=new Graph;
	CreatMGraph(g);
	display(g);
	return 1;
}
